//
//  BKUserSectionHeaderView.m
//  bestkeep
//
//  Created by windCould on 16/11/29.
//  Copyright © 2016年 utouu. All rights reserved.
//

#import "BKUserSectionHeaderView.h"
#import "BKMyCommon.h"
@interface BKUserSectionHeaderView ()

@property (nonatomic,strong)UILabel * subTitleLab;

@end


@implementation BKUserSectionHeaderView


-(instancetype)initWithFrame:(CGRect)frame withType:(NSInteger)type
{
    
   self.type = type;
   self =  [self initWithFrame:frame];
   return self;
}


-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self setUpViews];
        self.
        self.backgroundColor = BK_MY_COLOR_06;
    }
    
    return  self;
}

-(void)setTitleStr:(NSString *)titleStr
{
    _titleStr = titleStr;
    _titleLabel.text = _titleStr;
}


-(void)setUpViews{

    _titleLabel =[[UILabel alloc]initWithFrame:CGRectMake(10, 0, SCREENWIDTH-10 , self.bounds.size.height)];
    _titleLabel.font = [UIFont systemFontOfSize:15];
    _titleLabel.textColor = RGBCOLOR(68, 68, 68, 1);
    
    if (self.type == 1 || self.type == 2) {
        
    _titleLabel.textColor = [UIColor blackColor];
    _subTitleLab = [UILabel new];
    _subTitleLab.textColor = RGBCOLOR(178, 178, 178, 1);
    _subTitleLab.text = @"(必填)";
    if (self.type == 2) {
    _subTitleLab.text = @"(必选)";
    }
    _subTitleLab.font = [UIFont systemFontOfSize:15];
    [self addSubview:_subTitleLab];
    
    _subTitleLab.textAlignment = NSTextAlignmentLeft;
    }
        
        
    _titleLabel.textAlignment = NSTextAlignmentLeft;
    [self addSubview:_titleLabel];
    
    [self layoutViews];
}

-(void)layoutViews{
    
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
    
        make.left.mas_equalTo(self.mas_left).offset(ApplicationBackGauge);
        make.centerY.mas_equalTo(self.mas_centerY);
    }];
    
    if (self.type == 1 || self.type == 2) {
        
        [_subTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.mas_equalTo(_titleLabel.mas_right).offset(10);
            make.centerY.mas_equalTo(self.mas_centerY);
        }];
    }
    
    
}



@end
